#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    _myButton = new QPushButton(this);
    _myButton->setText("按键");

    _myButton->move(300,300);

    connect(_myButton,&QPushButton::clicked,this,&Widget::handleClicked);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleClicked()
{
    if(_myButton->text() == "按键")
    {
        _myButton->setText("Fuck");
        this->setWindowTitle("Fuck");
    }
    else if(_myButton->text() == "Fuck")
    {
        this->setWindowTitle("Bitch");
         _myButton->setText("按键");
    }
}

